package com.teach;

public class Test01 {
	public static void main(String[] args) {
		Thread t1 = new Thread(() ->{
			while(true) {
				System.out.println(Thread.currentThread().getName());
				try {
					Thread.sleep(500);
				} catch (Exception e) {
				}
			}
		});
		t1.setPriority(5);//设置优先级
		//Thread.MAX_PRIORITY=1;
		//Thread.MIN_PRIORITY=5;
		//Thread.NORM_PRIORITY=10;
		
		t1.setDaemon(true);//true：守护线程，false：默认，用户线程
		t1.start();
		for(int i=0;i<20;i++) {
			System.out.println(Thread.currentThread().getName());
			try {
				Thread.sleep(10000);
			} catch (Exception e) {
				// TODO: handle exception
			}
		}
		}
}
